<template>
  <div class="submit">
    <el-button style="padding: 0;transition: all .3s;" :class="{'loading':loading==name}" @click="clickMethod" type="primary">
      <span v-show="loading!=name"><slot></slot></span>
      <i v-show="loading==name" style="font-size: 24px;" class="el-icon-loading"></i>
    </el-button>
  </div>
</template>

<script>
export default {
  name: "zsh-button",
  props:{
    loading: {
      type:String
    },
    name:{
      type:String
    }
  },
  methods:{
    clickMethod(){
      this.$emit('click');
    }
  }
}
</script>

<style scoped lang="less">

.submit{
  margin:20px 0;
  text-align: center;
  .el-button{
    width: 100%;
    box-sizing: border-box;
    height: 40px;
  }
}

.loading {
  width: 80px !important;
  box-sizing: border-box;
  border-radius: 20px;
}
</style>
